package com.gitee.huanminabc.db_freedom.segments;


import com.gitee.huanminabc.db_freedom.utils.SqlFunction;

/**
 * 结构实现类
 * @param <T>
 * @param <Children>
 */
public abstract class SqlStructureImplSegments<T, Children extends SqlSpecialImplSegments<T, Children>>    extends SqlSpecialImplSegments<T, Children> implements SqlStructureSegments<Children, T, SqlFunction<T, ?>> {

    public SqlStructureImplSegments() {
    }

    public SqlStructureImplSegments(Class<?> entityClass, com.gitee.huanminabc.db_freedom.wrapper.SQL sql) {
        super(entityClass, sql);
    }



    @Override
    public Children SELECT() {
        SQL().append("SELECT ");
        return typedThis;
    }

    @Override
    public Children FROM() {
        SQL().append(" FROM ");
        SQL().append(getTableInfo().getTableName());
        SQL().append(" ");
        SQL().append(getTableInfo().getAlias());
        return typedThis;
    }


    @Override
    public Children WHERE() {
        SQL().append(" WHERE ");
        return typedThis;
    }




    @Override
    public Children INSERT() {
        SQL().append("INSERT INTO ");
        return typedThis;
    }

    @Override
    public final Children VALUES() {
        SQL().append(" VALUES ");

        return typedThis;
    }


    @Override
    public Children DELETE() {
        SQL().append("DELETE ");
        return typedThis;
    }

    @Override
    public Children SET() {
        SQL().append(" SET ");
        return typedThis;
    }

    @Override
    public Children UPDATE() {
        SQL().append("UPDATE ");
        return typedThis;
    }

    @Override
    public Children ORDER_BY() {
        SQL().append(" ORDER BY ");
        return typedThis;
    }

    @Override
    public Children HAVING() {
        SQL().append(" HAVING ");
        return typedThis;
    }

    @Override
    public Children GROUP_BY() {
        SQL().append(" GROUP BY ");
        return typedThis;
    }


    @Override
    public Children OFFSET() {
        SQL().append(" OFFSET ");

        return typedThis;
    }

    @Override
    public Children LIMIT() {
        SQL().append(" LIMIT ");
        return typedThis;
    }
}
